package com.taotao.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.taotao.common.pojo.EUTreeNode;
import com.taotao.common.pojo.TaotaoResult;
import com.taotao.service.ContentCatService;

@Controller
public class ContentCatController {
	@Autowired
	private ContentCatService contentCatService;
	
	@RequestMapping("/content/category/list")
	@ResponseBody
	public List<EUTreeNode> getContentCat(@RequestParam(value="id", defaultValue="0") long parentId) {
		return contentCatService.getContentCat(parentId);
	}
	
	
	@RequestMapping(value="/content/category/create", method=RequestMethod.POST)
	@ResponseBody
	public TaotaoResult createContent(long parentId, String name) {
		
		return contentCatService.createContent(parentId, name);
		
	}
	
	@RequestMapping(value="/content/category/update", method=RequestMethod.POST)
	@ResponseBody
	public TaotaoResult updateContent(long id, String name) {
		return contentCatService.updateContent(id, name);
	}
	
	@RequestMapping(value="/content/category/delete", method=RequestMethod.POST)
	@ResponseBody
	public TaotaoResult deleteContent(long id) {
		return contentCatService.deleteContent(id);
	}
}
